package android.longs.study.user.servlet;

import java.io.IOException;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import android.longs.study.base.HomeServlet;
import android.longs.study.user.service.UserServiceImple;
import android.longs.study.user.service.in.UserService;

@WebServlet("/user/register")
public class RegiserServlet extends HomeServlet{

    private UserService service = new UserServiceImple();
    @Override
    public void doRequestFunction(HttpServletRequest request,
	    HttpServletResponse response) {
	System.out.println("注册用户 ... .. ");
	try {
	    String addUser = service.registerFunction(request);

	    response.getWriter().write(addUser);
	    System.out.println("注册结果"+addUser
		    );
	} catch (Exception e) {
	    // TODO: handle exception
	    try {
		response.getWriter().write("注册异常 "+e.getMessage());
	    } catch (IOException e1) {
		// TODO Auto-generated catch block
		e1.printStackTrace();
	    }
	}

    }



}
